var LoginForm = new (function() {
	
	var $this = this;
	
	this.init = function() {
		$(".password-form").submit(cryptPasswordBeforeSend);
	};
	$(document).ready(this.init);
	
	function cryptPasswordBeforeSend(e) {
		var form = $(this);
		var inputsPassword = form.find(".password");
		var email = form.find(".email").val()
		for (var i = 0; i < inputsPassword.length; i++) {
			inputPassword = $(inputsPassword[i]);
			var password = inputPassword.val();
			if (password) {
				var cryptedPassword = $this.cryptPassword(email, password);
				inputPassword.val(cryptedPassword);	
			}
		}
		
	}
	
	this.cryptPassword = function(email, password) {
		return CryptoJS.SHA256(email+password+"japword");
	}
	
});